<template>
  <div class="tpl-page-container tpl-page-header-fixed">
    <div class="tpl-left-nav tpl-left-nav-hover">
      <div class="tpl-left-nav-title">
        菜单列表
      </div>
      <div class="tpl-left-nav-list">
        <ul class="tpl-left-nav-menu">
          <li class="tpl-left-nav-item">
            <router-link class="nav-link" :to="{ name: 'Home'}">
              <i class="am-icon-home"></i>
              <span>首页</span>
            </router-link>
          </li>
          <li class="tpl-left-nav-item">
            <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
              <i class="am-icon-th-list"></i>
              <span>车位系统</span>
              <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
            </a>
            <ul class="tpl-left-nav-sub-menu">
              <li>
                <router-link :to="{ name: 'ProjectView'}">
                  <i class="am-icon-angle-right"></i>
                  <span>车位管理</span>
                </router-link>
              </li>    
              <li>
                <router-link :to="{ name: 'InstructionLogView'}">
                  <i class="am-icon-angle-right"></i>
                  <span>指令日志</span>
                </router-link>
              </li>
              <li>
                <router-link :to="{ name: 'ParkView'}">
                  <i class="am-icon-angle-right"></i>
                  <span>停车记录</span>
                </router-link>
              </li>
              <li>
                <router-link :to="{ name: 'PayView'}">
                  <i class="am-icon-angle-right"></i>
                  <span>支付记录</span>
                </router-link>
              </li>
            </ul>
          </li>
          <li class="tpl-left-nav-item">
            <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
              <i class="am-icon-bookmark"></i>
              <span>平台用户</span>
              <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
            </a>
            <ul class="tpl-left-nav-sub-menu">
             <li>
              <router-link :to="{ name: 'PtWXView'}">
                <i class="am-icon-angle-right"></i>
                <span>用户信息</span>
              </router-link>
            </li>
     <!--        <li>
              <router-link :to="{ name: 'PtLoginLogView'}">
                <i class="am-icon-angle-right"></i>
                <span>登录日志</span>
              </router-link>
            </li>
            <li>
              <router-link :to="{ name: 'PtOperLogView'}">
                <i class="am-icon-angle-right"></i>
                <span>操作日志</span>
              </router-link>
            </li> -->
          </ul>
        </li>
        <li class="tpl-left-nav-item">
          <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
            <i class="am-icon-bookmark"></i>
            <span>管理用户</span>
            <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
          </a>
          <ul class="tpl-left-nav-sub-menu">
              <!--  <li>
                    <router-link :to="{ name: 'SysUserPage'}">
                      <i class="am-icon-angle-right"></i>
                      <span>用户信息</span>
                    </router-link>
                  </li> -->
                  <li>
                    <router-link :to="{ name: 'LoginLogView'}">
                      <i class="am-icon-angle-right"></i>
                      <span>登录日志</span>
                    </router-link>
                  </li>
                  <!-- <li>
                    <router-link :to="{ name: 'OperLogView'}">
                      <i class="am-icon-angle-right"></i>
                      <span>操作日志</span>
                    </router-link>
                  </li> -->
                </ul>
              </li>
            </ul>
          </div>
        </div>
        <router-view></router-view>
      </div>
    </template>

    <script>
      import * as apis from '../apis'
      import { mapGetters, mapActions } from 'vuex'
      export default {
        data(){
          return {
          }
        },
        created() {
          console.log('user->>>>', this.user)
      // this.user=window.sessionStorage.getItem('user')
      // console.log('user2', this.user)
      // let token = window.sessionStorage.getItem('token')
      // if (token) this.setUser
      
    },
    mounted () {
      $('.tpl-left-nav-link-list').on('click', function() {
        $(this).siblings('.tpl-left-nav-sub-menu').slideToggle(80)
        .end()
        .find('.tpl-left-nav-more-ico').toggleClass('tpl-left-nav-more-ico-rotate');
      })
    },
    computed: {
      ...mapGetters([
       'user'
       ])
    },
    methods: {
      
      authCheck(authCodes) {
      // if (!this.user) return false
      if (!this.user.isSubAccount) return true
       if (this.user.authCodes.includes('ALL_R') || this.user.authCodes.includes('ALL_M')) return true
         return authCodes.some(code => this.user.authCodes.includes(code))
     }
   }
 }
</script>
